
package com.task.base;

import android.app.PendingIntent;
import android.appwidget.AppWidgetManager;
import android.appwidget.AppWidgetProvider;
import android.content.Context;
import android.content.Intent;
import android.widget.RemoteViews;

public class TaskWidgetProvider extends AppWidgetProvider {

    @Override
    public void onUpdate(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds) {
        RemoteViews rv = new RemoteViews(context.getPackageName(), R.layout.appwidget_info);
        Intent intent = new Intent();
        intent.setAction(Util.ACTION_FREE_MEMORY);
        PendingIntent pendingIntent = PendingIntent.getBroadcast(context, 0, intent,
                PendingIntent.FLAG_UPDATE_CURRENT);
        for (int appWidgetId : appWidgetIds) {
            rv.setOnClickPendingIntent(R.id.clearmemory, pendingIntent);
            appWidgetManager.updateAppWidget(appWidgetId, rv);
        }

    }

}
